package com.gaojinqi.sys.modular.rbac.model;

import com.gaojinqi.base.common.model.BaseEntity;
import com.gaojinqi.base.core.jpa.annotation.Equals;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

import static com.gaojinqi.sys.modular.rbac.model.Role.TABLE_NAME;

/**
 * 角色实体
 *
 * @author gaojinqi
 * @version 1.0
 * @since 2020年04月15日
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Entity
@Table(name = TABLE_NAME)
@org.hibernate.annotations.Table(appliesTo = TABLE_NAME, comment = "系统角色表")
public class Role extends BaseEntity {

    private static final long serialVersionUID = -7609491492838927692L;

    public static final String TABLE_NAME = "sys_role";

    @Id
    @GeneratedValue(generator = TABLE_NAME + "_uuid")
    @GenericGenerator(name = TABLE_NAME + "_uuid", strategy = "uuid")
    @Column(columnDefinition = "varchar(32)  COMMENT '角色ID'")
    @Equals
    private String roleId;

    @Column(columnDefinition = "varchar(32) COMMENT '角色编码'", unique = true)
    @Equals
    private String role;

    @Column(columnDefinition = "varchar(32) COMMENT '角色名称'")
    private String roleName;

    @Column(columnDefinition = "varchar(128)  COMMENT '描述'")
    private String remark;

    @Column(columnDefinition = "int(16)  COMMENT '排序'")
    private Integer sort;

}
